package com.bwie.Es;

import com.bwie.pojo.Image;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.lang.annotation.Documented;
import java.util.Date;
import java.util.List;

@Data
@Document(indexName = "es_goods",shards = 1,replicas = 1)
public class EsGoods {
    @Id
    @Field(type = FieldType.Keyword)
    private Integer id;

    @Field(type = FieldType.Text)
    private String goodsName;

    @Field(type = FieldType.Text)
    private String goodsBrand;

    @Field(type = FieldType.Text)
    private String goodsNumber;

    @Field(type = FieldType.Double)
    private double goodsPrice;

    @Field(type = FieldType.Text)
    private String goodsSales;

    @Field(type = FieldType.Text)
    private String goodsIntroduce;

    @Field(type = FieldType.Text)
    private String goodsQuantity;

    @Field(type = FieldType.Text)
    private String goodsReviews;

    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date goodsCreatetime;

    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date goodsUpdatetime;

    @Field(type = FieldType.Text)
    private String status;

    @Field(type = FieldType.Text)
    private String goodsCity;

    @Field(type = FieldType.Text)
    private String goodsZhao;

    @Field(type = FieldType.Text)
    private String onename;

    @Field(type = FieldType.Text)
    private String twoname;

    @Field(type = FieldType.Text)
    private String threename;

    @Field(type = FieldType.Nested)
    private List<Image> imageList;


}
